package andev.axplorer.Tiles;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import java.util.ArrayList;
import java.util.Map;

/**
 * Created by lzy1g on 2015/8/2.
 */
public class TilesAdapterStorage extends BaseAdapter {
    private ArrayList<Map<String, Object>> mData;
    private Context mContext;

    public TilesAdapterStorage(Context context, ArrayList<Map<String, Object>> data) {
        mContext = context;
        mData = data;
    }

    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int position) {
        return mData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        TilesLayoutStorage tilesLayoutStorage = new TilesLayoutStorage(mContext);
        tilesLayoutStorage.setStorageName((String) mData.get(position).get("storageName"));
        tilesLayoutStorage.showStorageSize(mContext, position);
        return tilesLayoutStorage;
    }
}
